package com.net.xpay.common.manager.impl;

import com.google.common.base.Preconditions;
import com.net.common.dao.BasicMapper;
import com.net.common.dao.Page;
import com.net.xpay.common.dao.FrozenUserLogMapper;
import com.net.xpay.common.domain.FrozenUserLog;
import com.net.xpay.common.manager.FrozenUserLogManager;
import com.net.common.manager.AbstractManager;
import com.net.xpay.common.model.search.FrozenUserLogSearchModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
public class FrozenUserLogManagerImpl extends AbstractManager<FrozenUserLog> implements FrozenUserLogManager{

    @Autowired
    private FrozenUserLogMapper mapper;


    @Override
    protected BasicMapper<Long, FrozenUserLog> getMapper() {
        return mapper;
    }

    @Override
    public List<FrozenUserLog> search(FrozenUserLogSearchModel searchModel) {
        Preconditions.checkArgument(searchModel != null);
        Page page = new Page(searchModel);
        page.addOrder("id", "desc");
        return nonEmptyList(mapper.search(searchModel, page));
    }

    @Override
    public long searchCount(FrozenUserLogSearchModel searchModel) {
        Preconditions.checkArgument(searchModel != null);
        return mapper.searchCount(searchModel);
    }
}
